Skip to content

Conversation

@pontemonti
Copy link
Contributor

@pontemonti pontemonti commented Feb 4, 2026

This pull request introduces a hierarchical, provider-based configuration pattern throughout the Agents365 SDK, deprecating direct environment variable access and legacy utility functions. It adds new configuration classes and providers for runtime, tooling, and observability settings, and applies these patterns to both documentation and code. The changes also introduce OpenAI-specific observability configuration scaffolding, update linting rules to enforce the new configuration approach, and refactor token caching to use the new provider model.

Configuration System Overhaul

  • Introduced the configuration provider pattern across the SDK, with new classes: RuntimeConfiguration, ToolingConfiguration, and ObservabilityConfiguration, each with default singleton providers (e.g., defaultRuntimeConfigurationProvider). This enables hierarchical, function-based overrides for multi-tenant support and deprecates direct use of environment utilities. [1] [2] [3] [4]
  • Updated documentation to reflect the new configuration system, replacing function-based environment utilities with configuration properties and showing usage patterns for both default and custom providers. [1] [2] [3]

OpenAI Observability Extension

  • Added OpenAIObservabilityConfiguration and associated options/types, following the provider pattern for future extensibility and type safety. Exported a singleton provider (defaultOpenAIObservabilityConfigurationProvider) for this configuration. [1] [2] [3] [4]
  • Declared a dependency on @microsoft/agents-a365-runtime in the OpenAI observability extension package.

Agentic Token Cache Refactor

  • Refactored AgenticTokenCache to accept an IConfigurationProvider<ObservabilityConfiguration>, defaulting to defaultObservabilityConfigurationProvider, enabling per-tenant configuration and improved testability. Exported both the class and a default singleton instance. [1] [2] [3] [4] [5]

Linting and Code Quality

  • Updated ESLint configuration to enforce the use of configuration classes instead of direct process.env access and to disallow deprecated API usage, with exceptions for configuration, test, and utility files. [1] [2]

Documentation and Environment Variables

  • Expanded documentation of environment variables to include new observability settings and clarified their relationship to the new configuration classes. [1] [2]

These changes collectively modernize the SDK’s configuration approach, improve extensibility and testability, and lay the groundwork for multi-tenant and advanced observability scenarios.

Johan Broberg and others added 18 commits February 3, 2026 10:02
Resolved conflicts:
- observability/src/index.ts: Combined ILogger exports with configuration exports
- observability/src/utils/logging.ts: Merged setLogger/getLogger/resetLogger pattern
  with configuration provider support for DefaultLogger
- tooling/src/McpToolServerConfigurationService.ts: Combined imports for
  IConfigurationProvider with Authorization and AgenticAuthenticationService
- tooling/src/Utility.ts: Combined imports for IConfigurationProvider with ChannelAccount

Updated tests to match merged implementation:
- Removed createLogger factory tests (replaced by setLogger/getLogger/resetLogger)
- Updated GetAgenticUserToken expectations to include scopes parameter

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The scopes parameter was added as required in main branch, which is a
breaking change for existing consumers. This adds overloads to maintain
backward compatibility:

- 3-param signature (deprecated): Uses default MCP platform scope
- 4-param signature: Explicit scopes for better control

Existing code calling GetAgenticUserToken(auth, handler, ctx) will
continue to work, but callers are encouraged to migrate to the explicit
scopes overload for clarity.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…vider

Added detailed JSDoc explaining:
- The provider creates a single cached configuration instance
- Default module-level providers are singletons
- Two approaches for multi-tenant scenarios:
  1. Dynamic override functions reading from async context (recommended)
  2. Per-tenant provider instances when needed

This clarifies that while the singleton pattern is used, multi-tenancy is
still supported through function-based overrides that resolve at runtime.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Added documentation to AgenticTokenCacheInstance explaining it uses
  default configuration and when to create custom instances
- Exported AgenticTokenCache class so consumers can create instances
  with custom IConfigurationProvider for multi-tenant scenarios
- Added class-level documentation with usage example

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
… utility imports and updating server listing logic
@pontemonti pontemonti marked this pull request as ready for review February 5, 2026 06:36
@pontemonti pontemonti requested review from a team as code owners February 5, 2026 06:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request introduces a comprehensive hierarchical configuration provider pattern throughout the Agents365 SDK, replacing direct process.env access with configuration classes that support programmatic overrides and multi-tenant scenarios. The PR adds new configuration classes (RuntimeConfiguration, ToolingConfiguration, ObservabilityConfiguration) with default singleton providers, applies these patterns across runtime, tooling, and observability packages, and introduces extensive test coverage.

Changes:

  • Introduces configuration provider pattern with base RuntimeConfiguration class and package-specific extensions
  • Adds comprehensive test coverage for all configuration classes and related functionality
  • Deprecates direct environment variable access and legacy utility functions
  • Updates ESLint rules to enforce configuration usage and prevent deprecated API usage

Reviewed changes

Copilot reviewed 70 out of 71 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/agents-a365-runtime/src/configuration/* New configuration infrastructure with interfaces, base classes, and default providers
packages/agents-a365-runtime/src/power-platform-api-discovery.ts Converts ClusterCategory from type alias to enum for better type safety
packages/agents-a365-runtime/src/environment-utils.ts Deprecates utility functions and delegates to configuration classes where possible
packages/agents-a365-runtime/src/agentic-authorization-service.ts Adds overload accepting explicit scopes parameter
packages/agents-a365-tooling/src/configuration/* Tooling configuration extending runtime configuration
packages/agents-a365-tooling/src/Utility.ts Deprecates URL construction methods in favor of service usage
packages/agents-a365-tooling/src/McpToolServerConfigurationService.ts Refactored to use configuration provider
packages/agents-a365-observability/src/configuration/* Observability configuration extending runtime configuration
packages/agents-a365-observability/src/utils/logging.ts Updated to use configuration provider for dynamic log level resolution
packages/agents-a365-observability/src/tracing/* Multiple tracing utilities updated to use configuration
packages/agents-a365-observability-hosting/src/caching/AgenticTokenCache.ts Refactored to accept configuration provider
packages/agents-a365-*-extensions-*/src/configuration/* Extension-specific configurations for OpenAI, LangChain, Claude tooling and observability
tests/**/*.test.ts Comprehensive test coverage for all new configuration classes
eslint.config.mjs New rules to enforce configuration usage and prevent deprecated API usage
docs/*.md Documentation updates reflecting the new configuration pattern

tmlsousa
tmlsousa previously approved these changes Feb 5, 2026
juliomenendez
juliomenendez previously approved these changes Feb 6, 2026
nikhilNava
nikhilNava previously approved these changes Feb 6, 2026
@fpfp100
Copy link
Contributor

fpfp100 commented Feb 6, 2026

CHANGELOG.md is not updated.

…ationImprovements

# Conflicts:
#	pnpm-lock.yaml
…ants

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 6, 2026 18:58
fpfp100
fpfp100 previously approved these changes Feb 6, 2026
@pontemonti pontemonti enabled auto-merge (squash) February 6, 2026 19:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 70 out of 71 changed files in this pull request and generated 11 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

tmlsousa
tmlsousa previously approved these changes Feb 6, 2026
Johan Broberg added 2 commits February 6, 2026 11:59
- Introduced PerRequestSpanProcessorConfiguration to encapsulate per-request export settings.
- Removed per-request related properties from ObservabilityConfiguration.
- Updated documentation to reflect changes in configuration structure.
- Adjusted tests to validate new configuration class and removed obsolete tests.
- Ensured backward compatibility by maintaining environment variable handling for per-request settings.
@pontemonti pontemonti dismissed stale reviews from tmlsousa and fpfp100 via f4bbbde February 6, 2026 22:16
@pontemonti pontemonti merged commit 26700e2 into main Feb 7, 2026
7 checks passed
@pontemonti pontemonti deleted the users/johanb/ConfigurationImprovements branch February 7, 2026 00:05
fpfp100 added a commit that referenced this pull request Feb 7, 2026
* feat: Add x-ms-agentid header (#183)

Co-authored-by: Johan Broberg <johanb@microsoft.com>

* set gen_ai.caller.agent.type (#187)

Co-authored-by: jsl517 <pefan@microsoft.com>

* fix: update @isaacs/brace-expansion to version 5.0.1 (#181)

Co-authored-by: Johan Broberg <johanb@microsoft.com>

* feat: Add configuration provider interface (#184)

* Add PRD for configuration provider for Agent 365 SDK

* Change to dynamic resolution for configuration settings

* feat: Add configuration provider interface

* Update lock file

* fix: add backward-compatible overloads to GetAgenticUserToken

The scopes parameter was added as required in main branch, which is a
breaking change for existing consumers. This adds overloads to maintain
backward compatibility:

- 3-param signature (deprecated): Uses default MCP platform scope
- 4-param signature: Explicit scopes for better control

Existing code calling GetAgenticUserToken(auth, handler, ctx) will
continue to work, but callers are encouraged to migrate to the explicit
scopes overload for clarity.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: clarify multi-tenant usage patterns for DefaultConfigurationProvider

Added detailed JSDoc explaining:
- The provider creates a single cached configuration instance
- Default module-level providers are singletons
- Two approaches for multi-tenant scenarios:
  1. Dynamic override functions reading from async context (recommended)
  2. Per-tenant provider instances when needed

This clarifies that while the singleton pattern is used, multi-tenancy is
still supported through function-based overrides that resolve at runtime.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: clarify AgenticTokenCache singleton usage and export class

- Added documentation to AgenticTokenCacheInstance explaining it uses
  default configuration and when to create custom instances
- Exported AgenticTokenCache class so consumers can create instances
  with custom IConfigurationProvider for multi-tenant scenarios
- Added class-level documentation with usage example

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* add utility methods for parsing environment variables in RuntimeConfiguration

* add setLogger and resetLogger tests

* docs: enhance JSDoc comments for RuntimeConfigurationOptions

* docs: update deprecation notices and provide usage examples for environment utility functions

* refactor: update McpToolRegistrationService to use ClaudeToolingConfiguration

* refactor: update McpToolRegistrationService to use specific tooling configurations for LangChain and OpenAI

* refactor: ensure undefined checks for tooling overrides in ToolingConfiguration

* refactor: enhance ObservabilityConfiguration tests for environment variable handling

* refactor: streamline McpToolRegistrationService by removing redundant utility imports and updating server listing logic

* Address review feedback and discrepancies between documentation and code.

* Address additional feedback; add missing tests, improve documentation

* fix: add guardrails comment for PerRequestSpanProcessor default constants

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Johan Broberg <johanb@microsoft.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* Initial plan

* Fix test: Add event method to custom logger mocks

---------

Co-authored-by: Johan Broberg <johan@pontemonti.net>
Co-authored-by: Johan Broberg <johanb@microsoft.com>
Co-authored-by: PengF <126631706+fpfp100@users.noreply.github.com>
Co-authored-by: jsl517 <pefan@microsoft.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
fpfp100 added a commit that referenced this pull request Feb 9, 2026
* clean up

* support event logs and add events for export.

* Fix test failure after adding event method to ILogger interface (#186)

* Initial plan

* Fix test failure by adding event method to ILogger mocks

- Updated all mock ILogger objects in custom-logger.test.ts to include the event method
- Updated setLogger validation to check for event method
- Updated error message to include event method in validation

Co-authored-by: fpfp100 <126631706+fpfp100@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: fpfp100 <126631706+fpfp100@users.noreply.github.com>

* comments

* comments

* comments

* comment

* doc update

* Resolve merge conflicts with main branch (#188)

* feat: Add x-ms-agentid header (#183)

Co-authored-by: Johan Broberg <johanb@microsoft.com>

* set gen_ai.caller.agent.type (#187)

Co-authored-by: jsl517 <pefan@microsoft.com>

* fix: update @isaacs/brace-expansion to version 5.0.1 (#181)

Co-authored-by: Johan Broberg <johanb@microsoft.com>

* feat: Add configuration provider interface (#184)

* Add PRD for configuration provider for Agent 365 SDK

* Change to dynamic resolution for configuration settings

* feat: Add configuration provider interface

* Update lock file

* fix: add backward-compatible overloads to GetAgenticUserToken

The scopes parameter was added as required in main branch, which is a
breaking change for existing consumers. This adds overloads to maintain
backward compatibility:

- 3-param signature (deprecated): Uses default MCP platform scope
- 4-param signature: Explicit scopes for better control

Existing code calling GetAgenticUserToken(auth, handler, ctx) will
continue to work, but callers are encouraged to migrate to the explicit
scopes overload for clarity.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: clarify multi-tenant usage patterns for DefaultConfigurationProvider

Added detailed JSDoc explaining:
- The provider creates a single cached configuration instance
- Default module-level providers are singletons
- Two approaches for multi-tenant scenarios:
  1. Dynamic override functions reading from async context (recommended)
  2. Per-tenant provider instances when needed

This clarifies that while the singleton pattern is used, multi-tenancy is
still supported through function-based overrides that resolve at runtime.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: clarify AgenticTokenCache singleton usage and export class

- Added documentation to AgenticTokenCacheInstance explaining it uses
  default configuration and when to create custom instances
- Exported AgenticTokenCache class so consumers can create instances
  with custom IConfigurationProvider for multi-tenant scenarios
- Added class-level documentation with usage example

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* add utility methods for parsing environment variables in RuntimeConfiguration

* add setLogger and resetLogger tests

* docs: enhance JSDoc comments for RuntimeConfigurationOptions

* docs: update deprecation notices and provide usage examples for environment utility functions

* refactor: update McpToolRegistrationService to use ClaudeToolingConfiguration

* refactor: update McpToolRegistrationService to use specific tooling configurations for LangChain and OpenAI

* refactor: ensure undefined checks for tooling overrides in ToolingConfiguration

* refactor: enhance ObservabilityConfiguration tests for environment variable handling

* refactor: streamline McpToolRegistrationService by removing redundant utility imports and updating server listing logic

* Address review feedback and discrepancies between documentation and code.

* Address additional feedback; add missing tests, improve documentation

* fix: add guardrails comment for PerRequestSpanProcessor default constants

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Johan Broberg <johanb@microsoft.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* Initial plan

* Fix test: Add event method to custom logger mocks

---------

Co-authored-by: Johan Broberg <johan@pontemonti.net>
Co-authored-by: Johan Broberg <johanb@microsoft.com>
Co-authored-by: PengF <126631706+fpfp100@users.noreply.github.com>
Co-authored-by: jsl517 <pefan@microsoft.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

---------

Co-authored-by: jsl517 <pefan@microsoft.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Johan Broberg <johan@pontemonti.net>
Co-authored-by: Johan Broberg <johanb@microsoft.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants